# Contributor: Rasmus Thomsen <oss@cogitri.dev>
# Maintainer: Rasmus Thomsen <oss@cogitri.dev>
pkgname=searx
pkgver=0.17.0
pkgrel=0
pkgdesc="Privacy-respecting metasearch engine"
url="https://asciimoo.github.io/searx/"
arch="noarch"
license="AGPL-3.0"
depends="python3 py3-certifi py3-babel py3-flask py3-flask-babel py3-idna
	py3-jinja2 py3-lxml py3-pygments py3-openssl py3-dateutil py3-yaml
	py3-requests"
makedepends="py3-setuptools"
options="!check" # many missing deps, e.g. py3-splinter
source="https://github.com/asciimoo/searx/archive/v$pkgver/searx-$pkgver.tar.gz
	relax-dependencies.patch
	"

prepare() {
	default_prepare

	# Searx only searches in $PWD for these by default
	sed \
		-e 's|static_path : ""|static_path : "/usr/lib/python3.8/site-packages/searx/static"|' \
		-e 's|templates_path : ""|templates_path : "/usr/lib/python3.8/site-packages/searx/templates"|' \
		-i searx/settings.yml
}

build() {
	python3 setup.py build
}

check() {
	python3 setup.py test
}

package() {
	python3 setup.py install --prefix=/usr --root="$pkgdir"
	# Move the config to /etc
	mkdir -p "$pkgdir"/etc/searx
	mv "$pkgdir"/usr/lib/python*/site-packages/searx/settings.yml "$pkgdir"/etc/searx
}

sha512sums="d87dc559aa199ae61adcc22c5683ccd06ce9ce3a0d6cfb35d171ec8c5f0db8211ea9315dce0f0099338a137e862c8943d917b77077c8b0a00e081a443a4c0e5f  searx-0.17.0.tar.gz
0431400383b2ab7b5a12c96a3e86f1dd385c5c906ded607005b1877443fb2a497f06766d795d7fbe2d0c131a42efcf270595fcecc61ced76860a902b9270c736  relax-dependencies.patch"
